package org.autumn.thread;

import java.util.concurrent.TimeUnit;

public class InterruptMethod {
    public static void main(String[] args) throws InterruptedException {
        Thread t1 = new Thread(() -> {
            try {
                TimeUnit.SECONDS.sleep(2);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }, "t1");

        t1.start();
        // 让出cpu时间片 进入就绪状态
        t1.yield();
        TimeUnit.SECONDS.sleep(1);
        t1.interrupt();
        //
    }
}
